#ifndef	_MOD_UDA1341_HEADER_
#define	_MOD_UDA1341_HEADER_

#define PLAYWAV

#define	WAVE_FORMAT_PCM 						0x0001	//PCM data format 

enum{
UDA1431TS_ADDR_DATA0=0,
UDA1431TS_ADDR_DATA1=1,
UDA1431TS_ADDR_STATUS=2,
UDA1431TS_ADDR_NOT_USED=3
};

typedef struct tWAVEFORMATEX{
	short wFormatTag;
	short nChannels;
	int nSamplesPerSec;
	int nAvgBytesPerSec;
	short nBlockAlign;
	short wBitsPerSample;
	short cbSize;
}WAVEFORMATEX, *LPWAVEFORMATEX;

typedef struct wavehdr_tag{
	byte* lpData;
	int dwBufferLength;
	struct wavehdr_tag *lpNext;
	int reserved;
}WAVEHDR, *LPWAVEHDR;


typedef struct _AudioCodecStatus{
	ushort wFormatTag;
	ushort nChannels;	
	ushort wBitsPerSample;
	ushort Freq;
}AudioCodecStatus;

extern uint InterruptPlayComing;
extern uint InterruptRecComing;
extern DMAReg *AudioDMAPlay;
extern DMAReg *AudioDMARec;

////////////////////////////////////////////////////////////////////////////////////////////////
void Init1341(void);
void WrL3Addr(byte data);
void WrL3Data(byte data);
void IISPortSetup(void);
void Interrupt_DMAPlay(void);
void Interrupt_DMAREC(void);
void SetDmaPlay(void);
void SetDmaRec(void);
void PlayNextDMA(uint src_addr, uint dst_addr, uint len);
void RecNextDMA(uint src_addr, uint dst_addr, uint len);
void AudioDMASetup(void);
void AudioDMARemov(void);
void AudioPausePlay(byte mode);
void UDA1341_Volume(ushort volume);
void UDA1341_Mute(int mute);
void waveInAddBuffer(LPWAVEHDR pwh);
void waveOutAddBuffer(LPWAVEHDR pwh);
void waveOutGetVolume(uint* pdwVolume);
void waveOutSetVolume(int dwVolume);
void AudioTest(void);
void AudioTestRestart(void);

#endif
